package com.example.demo.handler;

import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.SocketIOServer;

/**
 * 房间处理器
 */
public class RoomHandler {
    private SocketIOServer server;
    private String room1id = "room1";
    private String room2id = "room2";

    public RoomHandler(SocketIOServer server){
        this.server = server;
    }

    public void joinRoom(SocketIOClient client,String roomId){
        System.out.println("当前客户端携带id");
        //如果客户端发送的id和服务端设置的两个群聊id相同
        if (roomId.equals(room1id) || roomId.equals(room2id)){
            //加入房间
           client.joinRoom(roomId);
           client.sendEvent("joinRoomSuccess",roomId);
        }
    }
}
